<?php


namespace Modules\Admin\Http\Controllers\Authorization\User;


use Illuminate\Support\Facades\DB;
use Modules\Common\General\Security\Authorization\Manager;
use Modules\Common\Models\AdminUser;
use Modules\Common\Util\Api;
use Modules\Common\Util\Database;

class Create
{
    /**
     * @Route(path=/api/admin/authorization/user method=post)
     */
    public function index()
    {
        DB::transaction(function () {
            $user = AdminUser::safeCreateWithRequestParams(['zh_name', 'mobile', 'password'], ['type' => 1, 'token_string' => Database::STR_DEFAULT]);
            $m = new Manager();
            $m->addUser($user->id);
        });
        return Api::success();
    }

}
